import request from '_utils/request'
// 请求商品列表
const fecthCateLists = (params = {}) => {
  return request.post('/cateLists', params)
}
// 请求商品分类列表
const fecthCartItem = (params = {}) => {
  return request.post('/cartItem', params)
}
// 增加商品
const addItem = (params = {}) => {
  return request.post('/itemAdd', params)
}
// 修改商品获取详情
const fecthItemDetail = id => {
  return request.get('/getItemDetail', { params: { id } })
}
// 编辑商品获取详情
const fecthCartDetail = id => {
  return request.get('/getCartDetail', { params: { id } })
}
// 修改商品接口
const itemUpdate = (params = {}) => {
  return request.put('/itemUpdate', params)
}
// 修改商品接口
const cartItens = (params = {}) => {
  return request.put('/cartItens', params)
}
// 删除商品
const fectdelItem = id => {
  return request.delete('/delItem', { params: { id } })
}

// 删除商品分类
const fectdelCart = id => {
  return request.delete('/delCart', { params: { id } })
}

// 用户登录接口
const fectLogin = (params = {}) => {
  return request.post('/login', params)
}
export {
  fecthCateLists,
  addItem,
  fecthItemDetail,
  itemUpdate,
  fecthCartItem,
  fecthCartDetail,
  cartItens,
  fectdelItem,
  fectdelCart,
  fectLogin
}
